Feat: HTML verification report - #529
Conversation
…irst generate an XML report
…ed in other projects
There was a problem hiding this comment.
Pull request overview
Adds HTML report generation to pact_verifier_cli by introducing a new --html <html-file> CLI option and implementing an XML→XSLT→HTML rendering pipeline for verification results.
Changes:
- Add
--html/PACT_VERIFIER_HTML_REPORTCLI option and wire it into verification handling. - Introduce XML report serialization (via
quick-xml+serde) and an embedded XSLT stylesheet to render the HTML report. - Add snapshot tests for the XML report and update CLI help output fixture.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| rust/pact_verifier_cli/tests/cmd/main.stderr | Updates CLI help snapshot to include the new --html flag. |
| rust/pact_verifier_cli/src/args.rs | Adds the --html CLI argument and env var support. |
| rust/pact_verifier_cli/src/lib.rs | Calls HTML report writer when --html is provided; adds/updates some public functions/docs. |
| rust/pact_verifier_cli/src/reports/mod.rs | Implements HTML report writing by generating XML and applying embedded XSLT via xrust. |
| rust/pact_verifier_cli/src/reports/xml.rs | New XML DTO + serializer for verification results, with snapshot tests. |
| rust/pact_verifier_cli/src/reports/verification-report.xsl | New XSLT stylesheet defining the HTML report layout/style. |
| rust/pact_verifier_cli/src/reports/snapshots/*.snap | Adds insta snapshots for XML serialization tests. |
| rust/pact_verifier_cli/Cargo.toml | Adds dependencies for XML serialization, XSLT transform, and snapshots. |
| rust/Cargo.lock | Lockfile updates for new dependencies. |
Comments suppressed due to low confidence (2)
rust/pact_verifier_cli/src/reports/mod.rs:116
path.parent()can be an empty path whenfile_nameis just a filename (e.g. "report.html"). Callingfs::create_dir_allwith an empty path is at best unnecessary and can error on some platforms. Consider skipping directory creation when the parent is empty (treat as current directory).
rust/pact_verifier_cli/src/reports/mod.rs:134--htmlcurrently always writes an additional sidecar XML file next to the HTML output (same basename,.xml). This is a user-visible side effect that can overwrite an existing file and isn’t implied by the flag name/help text. Consider transforming in-memory (no XML file), or make the XML output optional / clearly documented.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
This is great! You know what would be really helpful to add - output logs in collapsable or perhaps in a separate page in a directory. This way you can isolate the logs for the scenario. But that shouldn't stop this going out. If we wanted to future proof it, we could specify a directory for the |
Adds an
--htmloption to the verifier CLI to render an HTML report of the verification.Sample report:
